<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="/assets/css/admin.css">
<link rel="stylesheet" href="/assets/css/bootstrap-table.min.css">
<link rel="stylesheet" href="/assets/css/iconfont/iconfont.css">
<link rel="stylesheet" href="/assets/css/jquery.iviewer.css">
<title>人车人</title><link rel="icon" href="/assets/img/titleico.ico" type="image/x-icon">
<script src="/assets/js/jquery-1.11.0.min.js"></script>
<script src="/assets/js/jquery-ui.js"></script>
<script src="/assets/js/bootstrap.min.js"></script>
<script src="/assets/js/bootstrap-table.min.js"></script>
<script src="/assets/js/bootstrap-table-zh-CN.js"></script>
<script src="/assets/js/adminsg.js"></script>
<script src="/assets/js/axios.min.js"></script>
<script src="/assets/js/common.js"></script>
<script src="/assets/js/jquery.mousewheel.min.js"></script>
<script src="/assets/js/jquery.iviewer.js"></script>
<style>
	:root {
		overflow-x: auto;
	}
	
	.css3loadingbox .line-spin-fade-loader>div {
		background-color: #fff;
	}
	
	body {
		background-color: #fff;
		padding: 0;
		overflow: visible;
		width: 100%;
	}
	
	.headbody {
		padding-top: 20px;
		background-color: #fff;
	}
	
	.contariner {
		position: relative;
		overflow: hidden;
	}
	
	.contariner .col-md-12 {
		margin-top: 15px;
	}

	.orderprogress {
		overflow: hidden;
		font-size: 0;
		margin-bottom: 15px;
	}
	
	.orderprogress .pro {
		width: 55px;
		height: 85px;
		display: inline-block;
		vertical-align: top;
		text-align: center;
		position: relative;
	}
	
	.orderprogress .pro .circular {
		width: 55px;
		height: 55px;
		border: 3px solid #909092;
		border-radius: 50%;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}
	
	.orderprogress .pro .circular i {
		font-size: 26px;
		line-height: 46px;
		color: #909092;
	}
	
	.orderprogress .pro .text {
		color: #909092;
		line-height: 35px;
		font-size: 14px;
		white-space: nowrap;
		position: absolute;
    	width: 100px;
    	left: 50%;
    	margin-left: -50px;
	}
	
	.orderprogress .bor {
		width: 45px;
		height: 3px;
		background-color: #909092;
		display: inline-block;
		margin-top: 28px;
	}
	
	.orderprogress .pro.success .circular {
		border-color: #00cc33;
	}
	
	.orderprogress .pro.success .circular i {
		color: #00cc33;
	}
	
	.orderprogress .pro.success .text {
		color: #00cc33;
	}
	
	.orderprogress .bor.success {
		background-color: #00cc33;
	}
	
	.orderprogress .pro.err .circular {
		border-color: #f0ad4e;
	}
	
	.orderprogress .pro.err .circular i {
		color: #f0ad4e;
	}
	
	.orderprogress .pro.err .text {
		color: #f0ad4e;
	}
	
	.orderprogress .bor.err {
		background-color: #f0ad4e;
	}
	
	#tree dl,#alldownload .modal-body dl {
		margin-bottom: 0;
	}
	
	#tree dl.rootFile,#alldownload dl.rootFile {
		display: none;
	}
	
	#tree dl.tit,#alldownload .modal-body dl.tit {
		margin-bottom: 8px;
	}
	
	#tree dl.root.active {
		background-color: #f5f5f5;
	}
	
	#tree dt,#alldownload .modal-body dt {
		font-weight: normal;
	}
	
	#tree dl,#tree dl dt,#tree dl dt,#alldownload .modal-body dl,#alldownload .modal-body dl dt {
		cursor: pointer;
	}
	
	#tree dl dd.indent,#alldownload .modal-body dl dd.indent {
		margin-left: 15px;
	}
	
	#tree dl dt .glyphicon,#alldownload .modal-body dl dt .glyphicon {
		-webkit-transform: scale(.8);
		transform: scale(.8);
	}
	
	#tree dl dt span.err {
		-webkit-transform: scale(1);
		transform: scale(1);
		vertical-align: text-top;
	    margin-right: 5px;
	}
	
	#tree dl.show dd.indent,#alldownload .modal-body dl.show dd.indent {
		display: block;
	}
	
	#tree dl dt .glyphicon,#alldownload .modal-body dl dt .glyphicon {
		-webkit-transform: scale(.8);
		transform: scale(.8);
	}
	
	#tree dl dt .glyphicon-show,#alldownload .modal-body dl dt .glyphicon-show {
		-webkit-transform: scale(.8) rotate(90deg);
		transform: scale(.8) rotate(90deg);
	}
	
	#tree dl dd.indent,#alldownload .modal-body dl dd.indent {
		display: none;
	}
	
	.contariner .col-md-9 {
		padding-left: 0;
	}
	
	.contariner .col-md-9 .orderinfo {
		overflow: hidden;
	    border: 1px solid #ddd;
	    padding: 5px 0;
	    border-radius: 3px;
	    margin-bottom: 15px;
	}
	
	.contariner .col-md-9 .orderinfo div {
		padding-right: 0;
	}
	
	#windowdata .breadcrumb {
	    overflow: hidden;
	    padding: 8px 15px;
	    color: #777;
	}
	
	#windowdata .breadcrumb ol.col-md-9 {
	    margin: 0;
	    padding: 0;
	}
	
	#windowdata span.col-md-3 {
	    padding: 0;
	    float: right;
	}
	
	#windowdata .col-md-12 {
	    padding: 0;
	}
	
	#windowdata .col-md-12 ul li {
	    float: left;
	    cursor: pointer;
	    text-align: center;
	    margin-bottom: 10px;
	    padding: 8px;
	    border: 1px solid #fff;
	    border-radius: 5px;
	    width: 173px;
	    position: relative;
	    margin-right: 10px;
	}
	
	#windowdata .col-md-12 ul li .imgbox {
	    height: 98px;
	    overflow: hidden;
	}
	
	#windowdata .col-md-12 ul li a.download {
	    position: absolute;
	    top: 0;
	    bottom: 0;
	    left: 0;
	    right: 0;
	    z-index: 1;
	}
	
	#windowdata .col-md-12 ul li .imgbox .iconfont {
	    line-height: 105px;
	    font-size: 70px;
	}
	
	#windowdata .col-md-12 ul li .imgbox .iconfont.xlsx {
	    color: #508b37;
	}
	
	#windowdata .col-md-12 ul li .imgbox .iconfont.doc {
		color: #5b75b7;
	}
	
	#windowdata .col-md-12 ul li:hover {
	    background-color: #f1f7fd;
	    border-color: #b8d6fb;
	}
	
	.showimg {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 99;
		background-color: rgba(0, 0, 0, .8);
	}
	
	.showimg .imgbox {
		position: absolute;
		top: 10%;
		left: 20%;
		right: 20%;
		bottom: 10%;
	}
	
	.showimg .imgbox ul {
		margin: 0;
	}
	
	.showimg .imgbox ul.imgul {
		height: 100%;
	}
	
	.showimg .imgbox ul.imgul li {
		position: relative;
		height: 100%;
		display: none;
	}
	
	.showimg .imgbox ul.imgul li.active {
		display: block;
	}
	
	.showimg .imgbox ul.imgul li .imgdom {
		height: 100%;
	}
	
	.showimg .imgbox ul.imgul li .text {
		height: 100%;
		color: #fff;
	    text-align: center;
	    font-size: 30px;
	    line-height: 300px;
	}
	
	.showimg .imgbox ul.imgul li .info {
		position: absolute;
		width: 100%;
		height: 60px;
		left: 0;
		bottom: -60px;
	}
	
	.showimg .imgbox ul.imgul li .info p {
		color: #fff;
		font-size: 16px;
		text-align: center;
		margin: 10px 0 0 0;
	}
	
	.showimg .imgbox ul.imgul li .info .btn {
		display: block;
		margin: 10px auto 0;
		width: 150px;
	}
	
	.showimg .imgbox ul.imgul li .info .zoom {
		position: absolute;
	}
	
	.showimg .imgbox ul.btn li {
		position: absolute;
		top: 50%;
		width: 120px;
		height: 120px;
		line-height: 120px;
		text-align: center;
		margin-top: -60px;
	}
	
	.showimg .imgbox ul.btn li.left {
		left: -12%;
	}
	
	.showimg .imgbox ul.btn li.right {
		right: -12%;
	}
	
	.showimg .imgbox ul.btn li i {
		font-size: 66px;
		color: #fff;
	}
	
	.showimg .modal-dialog {
		display: none;
		position: absolute;
		margin: 0;
		z-index: 2;
		bottom: 46px;
		left: 50%;
		margin-left: -150px;
	}
	
	.modal-footer,.modal-body,.modal-header {
		padding: 5px;
	}
	
	.modal-header .close {
		margin: 0;
	}
	
	.modal-header h4 {
		font-size: 16px;
	}
	
	.modal-body .form-group {
		margin: 0;
	}
	
	#windowdata .col-md-12 ul li p {
	    margin-top: 10px;
	    margin-bottom: 2px;
	    width: 155px;
	    height: 20px;
	    text-overflow: ellipsis;
	    overflow: hidden;
	    white-space: nowrap;
	    padding: 0 10px;
	}
</style>
</head>
<body>
	#@allReviewDownLoad()
	#@alertsh()
	<div class="contariner" id="contariner">
		#@adminHeader()
		<div class="col-md-12">
			<div class="orderprogress" id="orderprogress"></div>
			<div class="col-md-9">
				<div class="orderinfo"></div>
				<div style="min-height: 680px;overflow: hidden;position: relative;" id="databox">
					<div class="windowdata col-md-12" id="windowdata">
						<div class="breadcrumb">
							<ol class="col-md-9" id="breadcrumb"></ol>
							<span class="col-md-3" id="filenum">当前&nbsp;<span>0</span>&nbsp;个&nbsp;&nbsp;&nbsp;共&nbsp;<span>0</span>&nbsp;个</span>
						</div>
						<div class="filelist col-md-12">
							<ul id="filelist" style="overflow: hidden;"></ul>
							<button class="uploadbtn btn btn-default btn-sm dropdown-toggle" style="display: none;" type="button" data-loading-text="正在上传...">开始上传</button>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-3" id="treebox">
				<div class="tree" id="tree" style="margin-bottom: 15px;"></div>
				<button id="downLoad" class="btn btn-primary col-md-6" data-toggle="modal" data-target="#alldownload">下载资料</button>
			</div>
		</div>		
	</div>
	<div class="showimg" id="showimg" style="visibility: hidden;">
		<div class="imgbox">
			<div class='css3loadingbox'
				style='position: absolute; top: 50%; left: 50%; margin: -40px 0 0 -40px;'>
				<div class='line-spin-fade-loader'>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
				</div>
			</div>
			<div class="modal-dialog modal-sm" isshow="false"
				style="display: none;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close cl">
							<span>&times;</span>
						</button>
						<h4 class="modal-title" id="exampleModalLabel">反馈信息</h4>
					</div>
					<div class="modal-body">
						<form>
							<div class="form-group">
								<textarea class="form-control" id="message-text"></textarea>
							</div>
						</form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn cl btn-default">关闭</button>
						<button type="button" class="btn btn-primary" id="fksubmit" data-loading-text="请稍后...">提交反馈</button>
					</div>
				</div>
			</div>
			<ul class="imgul"></ul>
			<ul class="btn">
				<li class="left"><i class="iconfont">&#xe8ef;</i></li>
				<li class="right"><i class="iconfont">&#xe8f1;</i></li>
			</ul>
		</div>
	</div>
	<div id="loginModal" class="modal" style="display:none">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" onclick="$('#loginModal').modal('hide')">x</button>
					<h1 class="text-center text-primary">选择生成项</h1>
				</div>
				<div class="modal-body" style="overflow: hidden;">
					<form action="" class="form col-md-12 center-block">
						<div class="form-group" id="exportContent">
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	
	<script>
		$(function(){
			var allData = null,
				treeDom = $("#tree"),//资源目录
				windowdata = $("#windowdata"),//窗口
				filelist = $("#filelist"),//文件列表
				filenum = $("#filenum"),//文件个数
				allFileNum = 0,//文件总个数
				datashowbox = $("#datashowbox"),//数据统计
				databox = $("#databox"),//数据展示层
				breadcrumb = $("#breadcrumb"),//面包屑导航
				fkmessage = $("#message-text"),//反馈输入框
				showimg = $("#showimg"),//背景层
				imgbox = showimg.children(".imgbox"),//可视区域
				imgboxW = imgbox.width(),
				imgboxH = imgbox.height(),
				imgul = imgbox.children("ul.imgul"),//图片容器
				modal_dialog = imgbox.children(".modal-dialog"),//反馈弹出框
				acIndex = -1,//切换索引默认等于-1
				treeHtml = "",
				allDownLoadHtml = "",
				dirindex = 0,
				loadingHtml = "<div class='css3loadingbox' style='position: absolute;top: 50%;left: 50%;margin: -40px 0 0 -40px;'>"+
							  "    <div class='line-spin-fade-loader'>"+
							  "        <div></div>"+
							  "        <div></div>"+
							  "        <div></div>"+
							  "	       <div></div>"+
						 	  "	       <div></div>"+
							  "	       <div></div>"+
							  "	       <div></div>"+
							  "	       <div></div>"+
							  "    </div>"+
							  "</div>";
			
			//获取宽度高度后隐藏
			showimg.removeAttr("style").hide()
			
			axios.post("/statis/getSourceInfo")
			.then(function(res){
				var orderId = res.data.orderInfo.order_id
				console.log(res.data)
				getBaseTab(res.data.source,true,"",orderId);
				filenum.children("span").eq(1).html(allFileNum).siblings("span").html(0);
				renderOrderInfo(res.data.orderInfo)
				_com.renderOrderProgress(res.data.progress)
			})
			
			var $rootPath = "",
				$fileIndex = 0
			function getBaseTab(data,root,parentPath,orderId){
				if(!data)return
				var rootHtml = "",
					rootDLHtml = ""
				for(var i = 0;i < data.length;i++){
					var isDir = data[i].isDir,
						path = parentPath
					if(isDir){
						var icon = "<span class='glyphicon glyphicon-menu-right' aria-hidden='true'></span>",
							isshow = "isshow='false'",
							isroot = "root";
						if(data[i].value.length <= 0){
							icon = "<span class='glyphicon glyphicon-menu-right' aria-hidden='true' style='opacity: 0;'></span>";
							isshow = "";
						}
						if(!root){
							isroot = "";
							path += data[i].lab + "/"
						}else{
							$rootPath = "/fileSrc/customer/"+orderId+"/资料包/"+data[i].lab + "/"
						}
						
						treeHtml += "<dl data-path='"+ $rootPath + path +"' class='tit dir "+ isroot +"' dirindex='"+ dirindex +"'><dt "+ isshow +">"+ icon + data[i].lab +"</dt><dd class='indent'>";
						allDownLoadHtml += "<dl class='tit dir "+ isroot +"' dirindex='"+ dirindex +"'><dt "+ isshow +"><input type='checkbox' class='dir check' value=''><span class='glyphicon glyphicon-menu-right' aria-hidden='true'></span>"+ data[i].lab +"</dt><dd class='indent'>";
						dirindex++;
						getBaseTab(data[i].value,false,path);
						treeHtml += "</dd></dl>";
						allDownLoadHtml += "</dd></dl>";
					}else{
						allFileNum++;
						var src = data[i].value.path,
							type = src.substring(src.lastIndexOf("."),src.lastIndexOf("?")).toLowerCase(),
							imgclz = "",
							paramter = "",//反馈提交name
							state = "",//状态
							err = "",//反馈内容
							errDom = "",//反馈提示
							errCls = "",//反馈className
							aDom = "<a href='"+ src +"'>"+ data[i].lab +"</a>";
						if(type == ".jpg" || type == ".jpeg" || type == ".png" || type == ".gif"){
							imgclz = "img";
							paramter = "data-paramter='"+ data[i].value.paramter +"'";
							state = "data-state='"+ data[i].value.state +"'";
							if(data[i].value.err)err = "data-err='"+ data[i].value.err +"'";
							aDom = data[i].lab;
							if(data[i].value.state == 3){
								errCls = "err-hook"
								errDom = "<span class='glyphicon glyphicon-info-sign err' style='color:#f0ad4e'></span>"
							}
						}
						var rootFile = "",
							downLoadSrc = src.split("?")[0]
						if(root){
							rootFile = "rootFile"
							rootHtml += "<dl class='file "+ imgclz +" "+ errCls +"' fileindex='"+ $fileIndex +"'><dt data-src='"+ src +"' "+ paramter +" "+ state +" "+ err +">"+ errDom +aDom +"</dt></dl>";
							rootDLHtml += "<dl class='file' fileindex='"+ $fileIndex +"'><dt><label><input type='checkbox' class='check sub' value='"+ downLoadSrc +"' >&nbsp;" + data[i].lab +"</label></dt></dl>";
						}else{
							allDownLoadHtml += "<dl class='"+ rootFile +" file' fileindex='"+ $fileIndex +"'><dt><label><input type='checkbox' class='check sub' value='"+ downLoadSrc +"' >&nbsp;" + data[i].lab +"</label></dt></dl>";
						}
						treeHtml += "<dl class='"+ rootFile +" file "+ imgclz +" "+ errCls +"' fileindex='"+ $fileIndex +"'><dt data-src='"+ src +"' "+ paramter +" "+ state +" "+ err +">"+ errDom +aDom +"</dt></dl>";
						
						$fileIndex++
					}
				}
				treeDom.html(treeHtml);
				$("#alldownload").find(".modal-body").html("<label class='all'><input type='checkbox' value=''>&nbsp;全选/取消全选</label>" + allDownLoadHtml);
				if(data.length === treeDom.children("dl").length){
					$("<dl class='tit dir root' dirindex='"+ dirindex +"'><dt isshow='false'><input type='checkbox' class='dir check' value=''><span class='glyphicon glyphicon-menu-right' aria-hidden='true'></span>资料包</dt><dd class='indent'>"+ rootDLHtml +"</dd></dl>").insertAfter($("#alldownload").find("label.all"))
					
					treeDom.prepend("<dl data-path='/fileSrc/customer/"+ orderId +"/资料包/' class='tit dir root' dirindex='"+ dirindex +"'><dt isshow='false'><span class='glyphicon glyphicon-menu-right' aria-hidden='true'></span>资料包</dt><dd class='indent'>"+ rootHtml +"</dd></dl>")
					getErrTip()
				}
			}
			
			//反馈提示和渲染资料包
			function getErrTip(){
				treeDom.find("dl.err-hook").each(function(){
					$(this).parents().each(function(){
						if($(this).hasClass("tree"))return false
						if($(this).hasClass("indent")){
							if($(this).siblings("dt").children(".err").length === 1)return false
							$("<span class='glyphicon glyphicon-info-sign err' style='color:#f0ad4e'></span>").insertAfter($(this).siblings("dt").children("span"))
						}
					})
				})
			}
			
			//渲染订单信息
			function renderOrderInfo (data) {
				var msgbox = $("<div style='margin-bottom: 10px;overflow: hidden;border: 1px solid #ddd;padding: 5px 0;border-radius: 3px;margin-bottom: 15px;' class='jkrmsg'></div>");
				$("#contariner .orderinfo").html("<div class='col-md-2'>客户姓名：<span style='color: #999;'>"+ data.name +"</span></div><div class='col-md-3'>客户电话：<span style='color: #999;'>"+ data.phone +"</span></div><div class='col-md-4'>客户身份证号码：<span style='color: #999;'>"+ data.idNo +"</span></div><div class='col-md-2'>审核人：<span style='color: #999;'>"+ data.assessor +"</span></div><div class='col-md-4'>业务经理：<span style='color: #999;'>"+ data.userName +"</span></div><div class='col-md-5'>业务经理电话：<span style='color: #999;'>"+ data.userPhone +"</span></div><div class='col-md-2'>审核时间：<span style='color: #999;'>"+ data.reviewDate +"</span></div>");
			}
			
			treeDom.on("click",".dir",function(e){
				e.stopPropagation();
				var dir = $(this),
					dt = dir.children("dt"),
					indent = dir.children(".indent"),
					dirIndex = dir.attr("dirindex"),
					path = dt.text()
					
				breadcrumb.html(path);
				
				if(dir.hasClass("root")){
					dir.addClass("active").siblings().removeClass("active")
				}else{
					dir.parents(".root").addClass("active").siblings().removeClass("active")
				}
				
				if(windowdata.attr("dirindex") != dirIndex){
					//展示第一个文件
					var html = "",
						childir = indent.children("dl"),
						fileNum = 0,
						index = 0;//图片展示索引
					dir.find(".file").each(function(){
						var chidt = $(this).children("dt"),
							src = chidt.data("src"),
							tit = chidt.text(),
							paramter = "",//反馈提交name
							state = "",//状态
							err = "",//反馈内容
							type = src.substring(src.lastIndexOf("."),src.lastIndexOf("?")).toLowerCase(),
							imgDom = "",
							imgclz = "",
							dataIndex = "",
							downLoadHtml = "<a href='"+ src +"' class='download'></a>",
							liCls = "",
							_fileIndex = $(this).attr("fileindex")
						if(type == ".jpg" || type == ".jpeg" || type == ".png" || type == ".gif"){
							downLoadHtml = "";
							liCls = "image-hook";
							imgDom = "<img src='"+ src +"' width='100%' />";
							imgclz = "img";
							paramter = "data-paramter='"+ chidt.data('paramter') +"'";
							state = "data-state='"+ chidt.data('state') +"'";
							dataIndex = "data-index='"+ index +"'";
							index++;
							if(!_x.isEmpty(chidt.data("err")))err = "data-err='"+ chidt.data("err") +"'";
						}else if(type == ".doc" || type == ".docx"){
							imgDom = "<i class='iconfont doc'>&#xe68b;</i>";
						}else if(type == ".xlsx" || type == ".xls"){
							imgDom = "<i class='iconfont xlsx'>&#xe605;</i>";
						}
						
						html += "<li fileindex='"+ _fileIndex +"' class='"+ liCls +"' "+ paramter +" "+ state +" "+ err +" "+ dataIndex +">"+
									downLoadHtml+
								"	<div class='imgbox "+ imgclz +"' data-src='"+ src +"'>"+
									imgDom+
								"	</div>"+
								"	<p>"+ tit +"</p>"+
								"</li>";
						fileNum++;
					})
					
					filelist.html(html);
					filenum.children("span").eq(0).html(fileNum);
					windowdata.attr("dirindex",dirIndex);
					windowdata.data("addindex",dirIndex);
				}
				if(dt.attr("isshow") == "false"){
					//展示目录
					dt.attr("isshow","true");
					dt.children(".glyphicon").addClass("glyphicon-show");
					indent.show();
				}else{
					dt.attr("isshow","false");
					dt.children(".glyphicon").removeClass("glyphicon-show");
					indent.hide();
				}
			})
			
			treeDom.on("click",".file",function(e){
				e.stopPropagation();
			})
			
			//展示图片
			filelist.on("click","li",function(){
				var that = $(this),
					liIndex = that.index();
				if(that.children(".imgbox").hasClass("img")){
					var paramter = that.data('paramter'),
						state = that.data('state'),
						err = that.data("err"),
						imgIndex = that.data("index"),
						dirIndex = that.parents(".windowdata").attr("dirindex"),
						showImgIndex = showimg.attr("dirIndex"),
						option = {//参数列表
							src:"",
							title:"",
							mark:true,
							isshowbtn:true,
							imgIndex:-1
						};
					
					acIndex = -1;
					fkmessage.attr("name",paramter).val(err);
					if(dirIndex != showImgIndex){
						showimg.attr("dirindex",dirIndex);
						imgul.html("");
						that.parent().find("img").each(function(index){
							var src = $(this).attr("src"),
								title = $(this).parent().siblings("p").text(),
								_paramter = $(this).parents("li").data('paramter')
							option.src = src;
							option.title = title;
							option.fkBtn = (paramter === "undefined" || _x.isEmpty(paramter))?"hide":"show"
							if(imgIndex == index){
								option.mark = true;
								getImg(option);
							}else{
								option.mark = false;
								getImg(option);
							}
						})
					}else{
						option.imgIndex = imgIndex;
						option.src = that.find("img").attr("src")
						option.title = that.find("p").text();
						getImg(option);
					}
					showimg.fadeIn(300);
					$('html').css("overflow","hidden")
				}/*else{
					
				}*/
			})
			
			//处理图片
			function getImg(opt){
				var src = opt.src,
					title = opt.title,
					mark = opt.mark,
					isshowbtn = opt.isshowbtn,
					imgIndex = opt.imgIndex,
					callback = opt.callback,
					isShowfkBtn = opt.fkBtn,
					image = new Image();
				image.src = src;
				var isShow = "style='display: none;'";
				
				if(imgIndex == -1){		
					var liDom = $("<li></li>"),	
						dom = $("<div></div>")
					
					liDom.html(loadingHtml)
					image.onload = function(){
						liDom.html("")
						var divDom = $("<div class='info'><p>"+ title +"</p></div>")
						dom.css({
							width: imgboxW,
							height: imgboxH,
							position: "relative"
						})
						dom.iviewer({
		                     src: src
		                });
						liDom.append(divDom).append(dom)
					}
					if(mark){
						liDom.addClass("active").siblings("li").removeClass("active")
					}
					imgul.append(liDom);
				}else{
					
					var nowLi = imgul.children("li").eq(imgIndex);
					nowLi.addClass("active").siblings("li").removeClass("active");
				}
				if(isshowbtn){
					showimg.find("ul.btn").show();
				}else{
					showimg.find("ul.btn").hide();
				}
			}
			
			//关闭图片展示
			showimg.on("click",function(e){
				$(this).fadeOut(300);
				$('html').removeAttr("style")
				modal_dialog.stop(true).fadeOut(300);
				modal_dialog.attr("isshow","false");
			})
			
			imgbox.on("click","img",function(e){
				e.stopPropagation();
			})
			
			imgbox.on("click",function(e){
				e.stopPropagation();
			})
			
			showimg.on("click","div.iviewer_common",function(e){
				e.stopPropagation()
			})
			
			//左右切换
			imgbox.children("ul.btn").children("li").on("click",function(e){
				e.stopPropagation();
				var lis = imgbox.children("ul.imgul").children("li");
				if(lis.length <= 1)return;			
				if(acIndex == -1){
					//找到active索引
					imgul.children("li").each(function(){
						if($(this).hasClass("active")){
							acIndex = $(this).index();
							return false;
						}
					})
				}
				if($(this).index()){//右边
					acIndex++;
					if(acIndex > imgul.children("li").length - 1){
						acIndex = 0;
					}
				}else{
					acIndex--;
					if(acIndex < 0){
						acIndex = imgul.children("li").length - 1;
					}
				}
				var nowLi = imgul.children("li").eq(acIndex),
					fileLi = filelist.children("li").eq(acIndex),
					paramter = fileLi.data("paramter"),
					state = fileLi.data("state"),
					err = fileLi.data("err");
				nowLi.addClass("active").siblings("li").removeClass("active");
				fkmessage.attr("name",paramter).val(err);
			})
			
			treeDom.on("click",".img",function(){
				imgul.html("");
				var that = $(this),
					dt = that.children("dt"),
					src = dt.data("src"),
					title = dt.text(),
					paramter = dt.data('paramter'),
					state = dt.data('state'),
					err = dt.data("err"),
					option = {//参数列表
						src:src,
						title:title,
						mark:true,
						isshowbtn:false,
						imgIndex:-1,
						callback:"single",
						fkBtn:(paramter === "undefined")?"hide":"show"
					};
				showimg.attr("dirindex",-1).fadeIn(300);		
				getImg(option);
				fkmessage.attr("name",paramter).val(err);
			})
			
			modal_dialog.on("click",function(e){
				e.stopPropagation();
			})
			
			imgul.on("click","button.btn",function(e){
				e.stopPropagation();
				showModal_dialog();
			})
			
			modal_dialog.on("click",".cl",showModal_dialog);
			
			//模态框展示和关闭
			function showModal_dialog(){
				if(modal_dialog.attr("isshow") == "false"){
					modal_dialog.stop(true).fadeIn(300);
					modal_dialog.attr("isshow","true")
				}else{
					modal_dialog.stop(true).fadeOut(300);
					modal_dialog.attr("isshow","false")
				}
			}
			
			//反馈提交
			$('#fksubmit').click(function(){
				var $btn = $(this)
				if(!_x.isEmpty(fkmessage.attr("name"))){
					var name,val,state;
					/* if (type == 0) {
						state = "5"
						$review.val("5")
					}else{
						state = "3"
					} */
					var val = fkmessage.val()
					if(_x.isEmpty(val)){
						fkmessage.attr("placeholder","请输入反馈内容！").focus()
						return
					}
					$btn.button('loading')
					var data = {paramterName:fkmessage.attr("name"),state:3,err:val};
					$.ajax({
						type:"post",
						url:"#(fkurl)",
						dataType:"json",
						data:data,
						success:function(data){
							if(data.code == "1"){
								modal_dialog.stop(true).fadeOut(300);
								modal_dialog.attr("isshow","false")
								_x.show_alert_sh(data.msg,true)
								//刷新逻辑
								var nowFileLi = filelist.children("li").eq(acIndex);
								nowFileLi.data("state",3).data("err",fkmessage.val());
								treeDom.find("dt[data-paramter='"+ fkmessage.attr('name') +"']").data("state",3).data("err",fkmessage.val());
								
								//当前文件夹中下一张
								acIndex++;
								if(acIndex < imgul.children("li").length){
									var nowLi = imgul.children("li").eq(acIndex),
										nextFileLi = filelist.children("li").eq(acIndex),
										paramter = nextFileLi.data("paramter"),
										state = nextFileLi.data("state"),
										err = nextFileLi.data("err");
									nowLi.addClass("active").siblings("li").removeClass("active");
									fkmessage.attr("name",paramter).val(err);
								}else{
									acIndex = imgul.children("li").length - 1;
								}
								
							}else{
								_x.show_alert_sh(data.msg,false)
							}
							$btn.button('reset')
						},
						error:function(){
							$btn.button('reset')
							_x.show_alert_sh("您的网络异常，请稍后重试！",false)
						}
					})
				}
			})
		})
	</script>
	
</body>
</html>